#include "tabtenn1.h"
#include <iostream>
int main_usett1()
{
    using std::endl;
    using std::cout;
    RatedPlayer rplayer1(1140,"Mallory", "Duck", true);
    rplayer1.Name();
    if (rplayer1.HasTable())
    {
       cout << " : Has a table.\n";
    }else
    {
       cout << " : Has not a table.\n";
    }
    
    TableTennisPlayer player1("Tara", "Boomdea", false);
    player1.Name();
    /*
    * 使用了dynamic_cast，那么子类中一定要有virtual方法才可以，
    * 同时virtual和方法的默认值一样，都是不可以在.cpp中出现的
    */
    TableTennisPlayer talbeTennis = rplayer1;
    RatedPlayer castRate = dynamic_cast <RatedPlayer &> (talbeTennis);
    castRate.Rating();
    if (player1.HasTable())
    {
        cout << " : Has a table.\n";
    }else
    {
        cout << " : Has not a table.\n";
    }
    
    cout << "Name: ";
    rplayer1.Name();
    cout << "; Rating: " << rplayer1.Rating() << endl;

    RatedPlayer rplayer2(1211,player1);
    cout << "Name: ";
    rplayer2.Name();
    cout << "; Rating: " << rplayer2.Rating() << endl;

    return 0;
}
